package com.uzai.common.enums;

/**
 * chat 消息来源类型
 * @Auther: cen
 * @Date: 2022-1-4 15:00:07
 * @Description:
 */
public enum MessageSourceTypeEnum {

    NORMAL(0,"表示普通聊天消息"),
    PAIR(1,"表示需要应答的成对消息"),
    SERVER_SEND(2,"表示服务器主动发出的消息(如订单消息)");

    private Integer id;
    private String desc;

    MessageSourceTypeEnum(Integer id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static MessageSourceTypeEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (MessageSourceTypeEnum type: MessageSourceTypeEnum.values()) {
            if (type.getId().intValue() == id) {
                return type;
            }
        }
        return null;
    }
}
